package com.xu.design.store.impl;

import com.alibaba.fastjson.JSON;
import com.xu.design.card.IQiYiCardService;
import com.xu.design.store.ICommodity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 *
 * @author xudenghui
 * @create 2023-07-18 9:43
 **/
public class CardCommodityService implements ICommodity {
    private Logger logger = LoggerFactory.getLogger(CardCommodityService.class);

    // 模拟注入
    private IQiYiCardService iQiYiCardService = new IQiYiCardService();

    @Override
    public void sendCommodity(String uid, String commodityId, String bizId, Map<String, String> extMap) throws Exception {
        String  mobile = queryUserMobile(uid);
        iQiYiCardService.grantToken(mobile, bizId);
        logger.info("请求参数{爱奇艺兑换卡}=> uId:{},commodityId:{},bizId{},extNao:{}",uid,commodityId,bizId,JSON.toJSON(extMap));
        logger.info("测试结果[爱奇艺兑换卡]：success");
    }

    private String queryUserMobile(String uid) {
        return  "15173240590";
    }
}
